package com.ruoyi.jkcrData.controller;

import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.jkcrData.domain.plat.DataJkcrJzhl;
import com.ruoyi.jkcrData.service.IDataJkcrJzhlService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletResponse;
import java.util.List;

/**
 * 架空乘人静张力测试数据Controller
 * 
 * @author ruoyi
 * @date 2024-02-19
 */
@RestController
@RequestMapping("/jkcrData/jzhl")
@Api(value="架空乘人-静张力测试",tags = "架空乘人-静张力接口")
public class DataJkcrJzhlController extends BaseController
{
    @Autowired
    private IDataJkcrJzhlService dataJkcrJzhlService;

    /**
     * 查询架空乘人静张力测试数据列表
     */
    @PreAuthorize("@ss.hasPermi('jkcrData:jzhl:list')")
    @GetMapping("/list")
    public TableDataInfo list(DataJkcrJzhl dataJkcrJzhl)
    {
        startPage();
        List<DataJkcrJzhl> list = dataJkcrJzhlService.selectDataJkcrJzhlList(dataJkcrJzhl);
        return getDataTable(list);
    }

    /**
     * 导出架空乘人静张力测试数据列表
     */
    @PreAuthorize("@ss.hasPermi('jkcrData:jzhl:export')")
    @Log(title = "架空乘人静张力测试数据", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, DataJkcrJzhl dataJkcrJzhl)
    {
        List<DataJkcrJzhl> list = dataJkcrJzhlService.selectDataJkcrJzhlList(dataJkcrJzhl);
        ExcelUtil<DataJkcrJzhl> util = new ExcelUtil<DataJkcrJzhl>(DataJkcrJzhl.class);
        util.exportExcel(response, list, "架空乘人静张力测试数据数据");
    }

    /**
     * 获取架空乘人静张力测试数据详细信息
     */
    @PreAuthorize("@ss.hasPermi('jkcrData:jzhl:query')")
    @GetMapping(value = "/{jzhlId}")
    public AjaxResult getInfo(@PathVariable("jzhlId") Long jzhlId)
    {
        return success(dataJkcrJzhlService.selectDataJkcrJzhlByJzhlId(jzhlId));
    }

    /**
     * 新增架空乘人静张力测试数据
     */
    @PreAuthorize("@ss.hasPermi('jkcrData:jzhl:add')")
    @Log(title = "架空乘人静张力测试数据", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody DataJkcrJzhl dataJkcrJzhl)
    {
        return toAjax(dataJkcrJzhlService.insertDataJkcrJzhl(dataJkcrJzhl));
    }

    /**
     * 修改架空乘人静张力测试数据
     */
    @PreAuthorize("@ss.hasPermi('jkcrData:jzhl:edit')")
    @Log(title = "架空乘人静张力测试数据", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody DataJkcrJzhl dataJkcrJzhl)
    {
        return toAjax(dataJkcrJzhlService.updateDataJkcrJzhl(dataJkcrJzhl));
    }

    /**
     * 修改架空乘人静张力测试数据
     */
    @PreAuthorize("@ss.hasPermi('jkcrData:jzhl:edit')")
    @Log(title = "修改架空乘人静张力测试数据", businessType = BusinessType.UPDATE)
    @PutMapping("/delJzhl/{jzhlId}")
    @ApiOperation(value="修改架空乘人静张力测试数据")
    public AjaxResult delJzhl(@PathVariable Long jzhlId)
    {
        return toAjax(dataJkcrJzhlService.updateDataJkcrJzhlByJzhlId(jzhlId));
    }

    /**
     * 删除架空乘人静张力测试数据
     */
    @PreAuthorize("@ss.hasPermi('jkcrData:jzhl:remove')")
    @Log(title = "架空乘人静张力测试数据", businessType = BusinessType.DELETE)
	@DeleteMapping("/{jzhlIds}")
    public AjaxResult remove(@PathVariable Long[] jzhlIds)
    {
        return toAjax(dataJkcrJzhlService.deleteDataJkcrJzhlByJzhlIds(jzhlIds));
    }
}
